package com.yuanfeng.order.feign;

import com.yuanfeng.commoms.dto.order.WapGoodsSaleSumDTO;
import com.yuanfeng.commoms.util.ResponseResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

/**
 * @author Stranger
 * @date 2023/3/20 12:47
 */
@FeignClient(name = "mall-goods", url = "http://localhost:8083")
public interface GoodServiceClient {

    /**
     * 根据goods_id查询积分商品的价格和所需的积分
     */
    @PostMapping("/goods/common/integralGoods/query")
    ResponseResult queryIntegralGoodsBygoodsId(@RequestBody Map<String,Object> param);

    /**
     * 查询是否为plus商品
     * @param commonId
     * @return
     */
    @PostMapping("goods/common/queryGoodsIsPlus")
    Integer queryGoodsIsPlus(@RequestParam Integer commonId);

    /**
     * 根据商家的商品id 查询供应商的商品价格
     * @param param
     * @return
     */
    @PostMapping("/goods/common/querySupplierGoodsPrice")
    ResponseResult querySupplierGoodsPrice(@RequestBody Map<String, Object> param);

    /**
     * 判断当前商品是否是 虚拟商品
     */
    @PostMapping("goods/common/queryVirtualgoods")
    ResponseResult queryVirtualgoods(@RequestBody Map<String,String> param);

    /**
     * 更新商品销量 库存
     * @param param
     */
    @PostMapping("goods/common/update/salesumStock")
    ResponseResult updateSaleSum(@RequestBody Map<String,String> param);

    /**
     * 获取商品信息
     *
     * @param goodsId
     * @return
     */
    @GetMapping("/goods/base/get/cart/getGoodsDetails")
    ResponseResult getGoodsDetails(@RequestParam("goodsId") Integer goodsId);

    /**
     * 取消下单时，增加库存
     *
     * @param param
     * @return
     */
    @PostMapping("/goods/common/update/stock/reduce")
    ResponseResult updateStockReduce(@RequestBody WapGoodsSaleSumDTO param);

    /**
     * 修改商品库存
     *
     * @param wapGood
     * @return
     */
    @PostMapping("/goods/common/update/goodsStock")
    ResponseResult updateGoodsStock(@RequestBody List<WapGoodsSaleSumDTO> wapGood);

    /**
     * 更新商品评论数
     *
     * @param map
     * @return
     */
    @PostMapping("/goods/common/updateCommentCount")
    ResponseResult updateCommentCount(@RequestBody Map<String, Object> map);


    @GetMapping("/goods/base/get/cart/getGoodsCommonDetails")
    ResponseResult getGoodsCommonDetails(@RequestParam("commonId") Integer commonId);

    @PostMapping("/goods/common/dealerOrderGoods")
    void dealerOrderGoods(Map<String, String> map);

    /**
     * 满赠减少赠品库存增加商品销量
     *
     * @param commonIdList
     * @return
     */
    @PostMapping("/goods/common/updateGiveawayStock")
    void updateGiveawayStock(@RequestBody List<Integer> commonIdList);
}
